package com.hs.jhzd.config;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class MqCondition implements Condition {

  /*
   * (non-Javadoc)
   * 
   * @see
   * org.springframework.context.annotation.Condition#matches(org.springframework.context.annotation
   * .ConditionContext, org.springframework.core.type.AnnotatedTypeMetadata)
   */
  @Override
  public boolean matches(ConditionContext conditionContext,
      AnnotatedTypeMetadata annotatedTypeMetadata) {
    String property = conditionContext.getEnvironment().getProperty("mq.switch");
    try {
      return Boolean.parseBoolean(property);
    } catch (Exception e) {
      return false;
    }
  }
}


